home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6368 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: I can't print the date in the format I want.
  5. Date: 24 Feb 1996 00:52:19 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb23175219@qcd.lanl.gov>
  8. References: <4g5nbf$8s0@newsbf02.news.aol.com> <3129e355.114134@news.iquest.net>
  9.     <825035732snz@genesis.demon.co.uk> <312de5dc.416111@news.iquest.net>
  10. NNTP-Posting-Host: qcd.lanl.gov
  11. Mime-Version: 1.0
  12. Content-Type: text
  13. In-reply-to: rclark@iquest.net's message of Fri, 23 Feb 1996 16:12:38 GMT
  14.  
  15. In article <312de5dc.416111@news.iquest.net>
  16. rclark@iquest.net (Robert B. Clark) writes:
  17. <snip>
  18. RBC: thought I'd comment on it anyway.  I suggested that if the original
  19. RBC: poster wanted to use it thus, he might want to hide it in a moe
  20. RBC: appropriately-named macro, such as
  21. RBC: 
  22. RBC:     #define PAUSE    if (getchar()) {}
  23.  
  24.  
  25. And then, (s)he would be tempted to write:
  26.  
  27.  if (some_funny_condition) PAUSE;
  28.  else just_show_the_results();
  29.  
  30. :-)
  31.  
  32. Why not the solution suggested in FAQ
  33. #define PAUSE do { if(getchar()) {} } while(0)
  34.  
  35. Of course, I have no idea what this is supposed to be doing ... I have
  36. not been following this thread. #define PAUSE (void)getchar() seems to
  37. be sufficient for most purposes, and compilers should be smart enough
  38. to recognize that an explicit cast to (void) means that the user is
  39. ignoring the return value deliberately. In any case, why the compiler
  40. should think that `code has no effect' is beyond me.
  41.  
  42. Cheers
  43. Tanmoy
  44. --
  45. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  46. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  47. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  48. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  49. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  50. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  51.